package com.lrkj.payfee.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.lrkj.common.annotation.Excel;
import com.lrkj.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 常规费用单对象 tb_rule_cost
 *
 * @author yajun_ren
 * @date 2021-07-30
 */
@Data
public class RuleCost extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 费用ID
     */
    private String costId;

    /**
     * 单据号
     */
    @Excel(name = "单据号")
    private String costNo;

    /**
     * 房屋id
     */
    @Excel(name = "房屋id")
    private String roomId;

    /**
     * 机构ID
     */
    @Excel(name = "机构ID")
    private String deptId;

    /**
     * 客户ID
     */
    @Excel(name = "客户ID")
    private String ownerId;

    /**
     * 收费类型
     */
    @Excel(name = "收费类型")
    private String projectId;

    /**
     * 收费项目
     */
    @Excel(name = "收费项目")
    private String chargeId;

    /**
     * 收费标准
     */
    @Excel(name = "收费标准")
    private String normId;

    /**
     * 房屋收费标准设置
     */
    @Excel(name = "房屋收费标准设置")
    private String roomNormId;

    /**
     * 应收日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Excel(name = "应收日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date receivableTime;

    /**
     * 计费开始日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Excel(name = "计费开始日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date beginTime;

    /**
     * 计费结束日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Excel(name = "计费结束日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date finishTime;

    /**
     * 单价
     */
    @Excel(name = "单价")
    private BigDecimal prices;

    /**
     * 金额
     */
    @Excel(name = "金额")
    private BigDecimal moneys;

    /**
     * 优惠金额
     */
    @Excel(name = "优惠金额")
    private BigDecimal specialMoney;

    /**
     * 优惠后金额
     */
    @Excel(name = "优惠后金额")
    private BigDecimal queenMoney;

    /**
     * 应收金额
     */
    @Excel(name = "应收金额")
    private BigDecimal receivableMoney;

    /**
     * 已收金额
     */
    @Excel(name = "已收金额")
    private BigDecimal haveMoney;

    /**
     * 实收金额
     */
    private BigDecimal paidMoney;

    //欠费金额
    private BigDecimal amountOwed;

    //冲抵金额
    private BigDecimal amountAmount;

    /**
     * 优惠政策
     */
    @Excel(name = "优惠政策")
    private String preferentialId;

    /**
     * 优惠折扣
     */
    @Excel(name = "优惠折扣")
    private String discount;


    /**
     * 费用收取类型
     */
    @Excel(name = "费用收取类型")
    private String costType;

    /**
     * 收全日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Excel(name = "收全日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date fullReceiptDate;

    /**
     * 状态
     */
    @Excel(name = "状态")
    private String status;

    /**
     * 祖级ID
     */
    private String ancestors;

    //缴费截止月
    private String paymentCycle;

    //优惠政策名称
    private String favouredPolicyName;

    //付款备注
    private String paymentNote;

    //计费行度
    private BigDecimal chargedLine;

    //抄表记录ID
    private String copyId;


    /*------------扩展字段----------*/

    //房屋名称
    private String roomName;
    //小区名称
    private String communityName;
    //收费标准名称
    private String normNames;

    //客户
    private String ownerName;

    //参数
    private String ruleCostIds;

    //费用明细ID
    private String receiptDetailId;

    //房屋IDS
    private String roomIds;


    private BigDecimal roomArea;
    private BigDecimal buildArea;

    private List<ReceiptRecord> receiptRecords;

    //结账期间
    private String fiscalPeriod;

    //批次标识,主要为了区分是在那个时间段生成的同一批次的费用单
    private String batcheNo;

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("costId", getCostId())
                .append("costNo", getCostNo())
                .append("roomId", getRoomId())
                .append("deptId", getDeptId())
                .append("ownerId", getOwnerId())
                .append("projectId", getProjectId())
                .append("chargeId", getChargeId())
                .append("normId", getNormId())
                .append("roomNormId", getRoomNormId())
                .append("receivableTime", getReceivableTime())
                .append("beginTime", getBeginTime())
                .append("finishTime", getFinishTime())
                .append("prices", getPrices())
                .append("moneys", getMoneys())
                .append("specialMoney", getSpecialMoney())
                .append("queenMoney", getQueenMoney())
                .append("receivableMoney", getReceivableMoney())
                .append("haveMoney", getHaveMoney())
                .append("costType", getCostType())
                .append("fullReceiptDate", getFullReceiptDate())
                .append("status", getStatus())
                .append("ancestors", getAncestors())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .toString();
    }
}
